package com.edu.study.base.lmsOrderReturnApply.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.edu.study.base.lmsOrderReturnApply.domain.LmsOrderReturnApply;
import com.edu.study.base.lmsOrderReturnApply.service.ILmsOrderReturnApplyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * LmsOrderReturnApplyController
 * 
 * @author zw
 * @date 2021-08-11
 */
@RestController
@RequestMapping("/LmsOrderReturnApply/LmsOrderReturnApply")
public class LmsOrderReturnApplyController extends BaseController
{
    @Autowired
    private ILmsOrderReturnApplyService lmsOrderReturnApplyService;

    /**
     * 查询LmsOrderReturnApply列表
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnApply:LmsOrderReturnApply:list')")
    @GetMapping("/list")
    public TableDataInfo list(LmsOrderReturnApply lmsOrderReturnApply)
    {
        startPage();
        List<LmsOrderReturnApply> list = lmsOrderReturnApplyService.selectLmsOrderReturnApplyList(lmsOrderReturnApply);
        return getDataTable(list);
    }

    /**
     * 导出LmsOrderReturnApply列表
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnApply:LmsOrderReturnApply:export')")
    @Log(title = "LmsOrderReturnApply", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LmsOrderReturnApply lmsOrderReturnApply)
    {
        List<LmsOrderReturnApply> list = lmsOrderReturnApplyService.selectLmsOrderReturnApplyList(lmsOrderReturnApply);
        ExcelUtil<LmsOrderReturnApply> util = new ExcelUtil<LmsOrderReturnApply>(LmsOrderReturnApply.class);
        return util.exportExcel(list, "LmsOrderReturnApply");
    }

    /**
     * 获取LmsOrderReturnApply详细信息
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnApply:LmsOrderReturnApply:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(lmsOrderReturnApplyService.selectLmsOrderReturnApplyById(id));
    }

    /**
     * 新增LmsOrderReturnApply
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnApply:LmsOrderReturnApply:add')")
    @Log(title = "LmsOrderReturnApply", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LmsOrderReturnApply lmsOrderReturnApply)
    {
        return toAjax(lmsOrderReturnApplyService.insertLmsOrderReturnApply(lmsOrderReturnApply));
    }

    /**
     * 修改LmsOrderReturnApply
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnApply:LmsOrderReturnApply:edit')")
    @Log(title = "LmsOrderReturnApply", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LmsOrderReturnApply lmsOrderReturnApply)
    {
        return toAjax(lmsOrderReturnApplyService.updateLmsOrderReturnApply(lmsOrderReturnApply));
    }

    /**
     * 删除LmsOrderReturnApply
     */
    @PreAuthorize("@ss.hasPermi('LmsOrderReturnApply:LmsOrderReturnApply:remove')")
    @Log(title = "LmsOrderReturnApply", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(lmsOrderReturnApplyService.deleteLmsOrderReturnApplyByIds(ids));
    }
}
